package com.smallbug.longman;


import com.smallbug.longman.bean.EXAMPLE;
import com.smallbug.longman.bean.Entry;
import com.smallbug.longman.bean.HEAD;
import com.smallbug.longman.bean.Sense;
import com.smallbug.longman.bean.Subsense;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.StaxDriver;

/**
 * Created by tongxu on 2017/11/6.
 */

public  class XmlHelper {

    public static Entry analysingXml(String xml){

        XStream xstream = new XStream(new StaxDriver());
        xstream.alias("Entry", Entry.class);
        xstream.alias("Head", HEAD.class);
        xstream.alias("Sense", Sense.class);
        xstream.alias("EXAMPLE", EXAMPLE.class);
        xstream.alias("Subsense", Subsense.class);
        return (Entry) xstream.fromXML(xml);

    }
}
